<?php
namespace Home\Controller;
use Think\Controller;
class QqController extends Controller {
    public function index(){
        $appname='QQ凶吉查询';
        $this->assign('appname',$appname);//应用名称
        $this->display();
    }
    public function doqq(){
        $appkey = "a4807dc08a80ce1720b9b2e026327a02";
//************1.QQ号码测吉凶 ************
        $url = "http://japi.juhe.cn/qqevaluate/qq";
        $params = array(
            "key" => $appkey,//您申请的appKey
            "qq" => $_POST['qq'],//需要测试的QQ号码
        );
        $paramstring = http_build_query($params);
        $content = juhecurl($url,$paramstring);
        $result = json_decode($content,true);
        if($result){
            if($result['error_code']=='0'){
                $xinxi=arr_foreach($result);
                $jian = preg_replace('/\[(.*)\]/isU', "", $xinxi[2]);
                preg_match('/\[(.*)\]/isU',$xinxi[2],$m);
                $qq=array(
                    qq=>I('post.qq'),
                    tx=>'http://q1.qlogo.cn/g?b=qq&nk='.I('post.qq').'&s=100&t='.time(),
                    xiongji=>$m[1],
                    jian=>$jian,
                    xiang=>$xinxi[3],
                );
                $this->assign('qq',$qq);
                $this->display();
            }else{
                echo $result['error_code'].":".$result['reason'];
            }
        }else{
            echo "请求失败";
        }
    }
}